// custom-tab-bar/index.js
Component({
  properties: {
    activateIndex: {
      type: Number,
      value: 0,
    },
  },
  data: {
    selected: 0,
    color: "#7A7E83",
    selectedColor: "#0000cc",
    tabbarList: [
      {
        txt: '首页',
        url: 'home/index.wxml',
        img: 'icon/home.png',
        selectedImg: 'icon/home.png'
      },
      {
        txt: '',
        url: 'sold/index.wxml',
        img: 'icon/add.png',
        selectedImg: '/icon/add.png'
      },
      {
        txt: '我的',
        url: 'usercenter/index.wxml',
        img: '/icon/center.png',
        selectedImg: '/icon/center.png'
      }
    ],
  },
  methods: {
    toDetails:function(e) {
      const dataset=e.currentTarget.dataset;
      var URL=dataset.url;
      const index=dataset.index;
      URL= URL.substring(0,URL.length-5);
      wx.switchTab({
        url: '/pages/'+URL,
      })
      this.setData({
        selected: index
      })
    }
  }
})
